package sanshi.contect.udpstarter.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import sanshi.contect.udpstarter.client.UDPClient;
import sanshi.contect.udpstarter.entity.UDPEntity;

/**
 * 读取yml配置类
 * 并将client进行注册
 * @author sanshi
 */
@Order(value = 1)
@Configuration
@EnableConfigurationProperties(UDPEntity.class) //开启配置累
public class UDPClientAutoConfig {

    @Autowired
    private UDPEntity entity;

    @Bean
    public UDPClient client(){
        UDPClient client = new UDPClient();
        client.setEntity(entity);
        return client;
    }

}
